package com.zyh.scs.admin.api.constant;

import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * 满客宝-机构同步-更新类型 枚举类
 */
@Getter
public enum MKBApiOrgUpdateType {

    INSERT(1, "添加"),
    UPDATE(2, "更新"),
    DELETE(3, "删除"),

    UNKOWN(-99999, "未知"),
    ;

    private final Integer code;
    private final String codeName;

    MKBApiOrgUpdateType(Integer code, String codeName) {
        this.codeName = codeName;
        this.code = code;
    }

    public static MKBApiOrgUpdateType get(Integer code) {
        return Arrays.stream(MKBApiOrgUpdateType.values())
                .filter(orderStatus -> Objects.equals(orderStatus.getCode(), code))
                .findFirst().orElse(MKBApiOrgUpdateType.UNKOWN);
    }

}